<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:icecore="http://www.icefaces.org/icefaces/core"
    xmlns:ace="http://www.icefaces.org/icefaces/components"
    xmlns:ice="http://www.icesoft.com/icefaces/component">

    
    <h:head>
       <title>Transaction Files Search</title>
       <h:outputStylesheet library="#{localeBean.currentLocale}/css" name="style.css" />
    </h:head>
	<h:body>
        <ui:composition template="/template/masterTemplate.xhtml">
		<ui:define name="content">
			<h:form  id="searchForm">
				<h:panelGroup id="container" styleClass="content">
					<ice:outputLabel value="#{msgs['trnsctionFile.label.title']}" /><br/>
					<h:message for="searchTransNo" style="color: red;"/>
					<ice:panelGrid columns="4" cellspacing="10" width="100%">
						<ice:outputLabel value="#{msgs['trnsctionFile.label.transNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.searchCriteria.transactionNumber}" id="searchTransNo"
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.transNo']}"/>
						
						<ice:outputLabel value="#{msgs['trnsctionFile.label.realtyNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.searchCriteria.realtyNumber}" />
					
						<ice:outputLabel value="#{msgs['trnsctionFile.label.realRegstNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.searchCriteria.realtyRegistrationNumber}" />
						
						<ice:outputLabel value="#{msgs['trnsctionFile.label.docType']}" />
						<h:selectOneMenu value="#{transactionFileSearchBean.searchCriteria.documentType}">
							<f:selectItem itemValue="1" itemLabel="Transaction Documents" />
							<f:selectItem itemValue="2" itemLabel="Realty Registration" />
							<f:selectItem itemValue="3" itemLabel="Ownership Document" />
							<f:selectItem itemValue="4" itemLabel="Contracts and Records" />
							<f:selectItem itemValue="5" itemLabel="IDs" />
							<f:selectItem itemValue="6" itemLabel="Payment Invoice" />
						</h:selectOneMenu>
						
						<ice:outputLabel value="#{msgs['trnsctionFile.search.label.transDate.from']}" />
						<ice:selectInputDate renderAsPopup="true" value="#{transactionFileSearchBean.dateFrom}" 
									 highlightClass="dateHighlightGray"
                                     renderMonthAsDropdown="true"
                                     renderYearAsDropdown="true"  id="fromDateCal"  imageDir="ltr"/>
                             
						<ice:outputLabel value="#{msgs['trnsctionFile.search.label.transDate.to']}" />
						<ice:selectInputDate renderAsPopup="true" value="#{transactionFileSearchBean.dateTo}" 
									 highlightClass="dateHighlightGray"
                                     renderMonthAsDropdown="true"
                                     renderYearAsDropdown="true"  id="toDateCal"  imageDir="ltr"/>
						
					</ice:panelGrid>	
					<ice:panelGrid columns="2" style="align:center" >
						<ice:commandButton value="#{msgs['btn.label.search']}" action="#{transactionFileSearchBean.getSearchResaultList}" />
						<h:commandButton value="#{msgs['add.label.trnsctionF']}" onclick="addDialog.show();" action="#{transactionFileSearchBean.reset}" rendered="#{userBean.isAdmin or userBean.isDataEntry}"/>
						
					</ice:panelGrid>
					
					
					<ace:panel rendered="#{not empty transactionFileSearchBean.searchResault}" id="searchResultPanel">
				  
						<ace:dataTable value="#{transactionFileSearchBean.searchResault}"  binding="#{table}"
		                          var="item" paginator="true" paginatorPosition="bottom" rows="5">
		                
		                <ace:column headerText="#{msgs['realtydocument.lable.search.show']}">
                			<h:commandButton id="viewBtn#{table.rowIndex}"
                							action="#{transactionFileSearchBean.viewDoc(table.rowIndex)}" 
                							value="#{msgs['realtydocument.lable.search.show']}" onclick="viewDialog.show();">
                					<f:ajax render="@all"/>
                			</h:commandButton>
		                </ace:column>
		                
		                <ace:column headerText="#{msgs['btn.label.edit']}">
                			<h:commandButton id="editBtn#{table.rowIndex}"
                							action="#{transactionFileSearchBean.edit(table.rowIndex)}" 
                							value="#{msgs['btn.label.edit']}" onclick="addDialog.show();">
                					<f:ajax render="@all"/>
                			</h:commandButton>
		                 </ace:column>
		                
		                 <ace:column headerText="#{msgs['realtydocument.lable.search.delete']}">
                			<h:commandButton id="deleteBtn#{table.rowIndex}"  action="#{transactionFileSearchBean.delete}" 
                							value="#{msgs['realtydocument.lable.search.delete']}">
                				<f:param name="deletedIndex" value="#{table.rowIndex}"/>
                			</h:commandButton>
		                 </ace:column>
		                 
		                 <ace:column headerText="#{msgs['trnsctionFile.label.transNo']}">
		                    <h:outputText  value="#{item.transactionNumber}"/>
		                 </ace:column>
		                
		                 <ace:column headerText="#{msgs['trnsctionFile.label.realtyNo']}" >
		                    <h:outputText  value="#{item.realtyNumber}"/>
		                 </ace:column>
		                 
		                 <ace:column headerText="#{msgs['trnsctionFile.label.realRegstNo']}" >
		                    <h:outputText  value="#{item.realtyRegistrationNumber}"/>
		                 </ace:column>
		               
		            </ace:dataTable>
			</ace:panel>
				
			</h:panelGroup>

            <ace:dialog id="viewDialog"
                        header=""
                        widgetVar="viewDialog"
                        closable="true"
                        modal="true"
                        draggable="false"
                        showEffect="clip"
                        hideEffect="fade"
                        width="1300"  
                        height="400" position="fixed">
   						<iframe src="#{transactionFileSearchBean.url}" width="100%" height="90%" scrolling="yes"/>
   						
   			 </ace:dialog>
            
            
			</h:form>
			
			
			<ace:dialog id="addDialog"
                       header="#{msgs['add.label.trnsctionF']}"
                       widgetVar="addDialog"
                       closable="true"
                       modal="true"
                       draggable="false"
                       showEffect="clip"
                       hideEffect="fade"
                       width="1300"  
                       height="400">
                  <h:form>
	                  <h:panelGroup>
	                  		<h:messages showSummary="true" style="color:red;" />
	                  </h:panelGroup>     
	                  <ice:outputLabel value="#{msgs['trnsctionFile.label.title']}" />
					
					<ice:panelGrid columns="4" cellspacing="10" width="100%">
					
						<ice:outputLabel value="#{msgs['trnsctionFile.label.transNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.transactionFile.transactionNumber}"
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.transNo']}"/>
							
						<ice:outputLabel value="#{msgs['trnsctionFile.label.transDate']}" />
						<ice:selectInputDate renderAsPopup="true" value="#{transactionFileSearchBean.transactionFile.transactionDate}" 
									 highlightClass="dateHighlightGray"
	                                    renderMonthAsDropdown="true"
	                                    renderYearAsDropdown="true"  id="cal"  imageDir="ltr"
	                                    required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.transDate']}"/>
	                                      
						<ice:outputLabel value="#{msgs['trnsctionFile.label.dailyRecord']}" />
						<ice:inputText value="#{transactionFileSearchBean.transactionFile.dailyRecordNumber}" 
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.dailyRecord']}"/>
						
						<ice:outputLabel value="#{msgs['trnsctionFile.label.realtyNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.transactionFile.realtyNumber}" 
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.realtyNo']}"/>
	
						<ice:outputLabel value="#{msgs['trnsctionFile.label.realRegstNo']}" />
						<ice:inputText value="#{transactionFileSearchBean.transactionFile.realtyRegistrationNumber}" 
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.realRegstNo']}"/>
							
					</ice:panelGrid>
					
					<ice:panelGrid columns="5" cellspacing="10" width="100%" >
					
						<ice:commandButton  value="#{msgs['btn.label.save']}" action="#{transactionFileSearchBean.addTransactionDoc}" id="addBtn" />
						<ice:commandButton value="#{msgs['btn.label.scan']}" />
						<ice:commandButton value="#{msgs['btn.label.upload']}" />
						
						<ice:outputLabel value="#{msgs['trnsctionFile.label.docType']}" />
						<h:selectOneMenu value="#{transactionFileSearchBean.transactionFile.documentType}"
							required="true"  requiredMessage="#{msgs['err.required']} #{msgs['trnsctionFile.label.docType']}">
							<f:selectItem itemValue="1" itemLabel="Transaction Documents" />
							<f:selectItem itemValue="2" itemLabel="Realty Registration" />
							<f:selectItem itemValue="3" itemLabel="Ownership Document" />
							<f:selectItem itemValue="4" itemLabel="Contracts and Records" />
							<f:selectItem itemValue="5" itemLabel="IDs" />
							<f:selectItem itemValue="6" itemLabel="Payment Invoice" />
						</h:selectOneMenu>
						<ace:panel style="width: 250px; height: 40px; border: 0px;">
	                                <ace:fileEntry id="file-entry" 
	                               					absolutePath="/upload"
	                                                   maxFileCount="1" 
	                                                   maxFileCountMessage="Limited to 10 files uploaded concurrantly." 
	                                                   fileEntryListener="#{transactionFileSearchBean.fileUploadListener}" 
	                                                   maxFileSizeMessage="Submitted file is too large." 
	                                                   maxTotalSize="6291456" 
	                                                   useOriginalFilename="true" 
	                                                   useSessionSubdir="false"/>
	                                                   <h:commandButton immediate="true" type="submit" value="sumit"/>
	                       </ace:panel>
					</ice:panelGrid>
				</h:form>
           </ace:dialog>
		</ui:define>
	</ui:composition>
	</h:body>
</html>


